<?php

	define('ABSOLUTE_SERVER_REMOTE_ADDR','../../'); //admin
	define('ABSOLUTE_SERVER_DOCUMENT_ROOT','../../');

    include(ABSOLUTE_SERVER_DOCUMENT_ROOT.'session.inc');
    require_once(ABSOLUTE_SERVER_DOCUMENT_ROOT.'funct.inc');
	require_once(ABSOLUTE_SERVER_DOCUMENT_ROOT.'functs.inc');
	require_once('shared_products.inc');
	include ABSOLUTE_SERVER_DOCUMENT_ROOT.'color_style.php';
    include ABSOLUTE_SERVER_DOCUMENT_ROOT.LANGUAGE;
    require_once('../../../classDB.inc.php');

    if(!GetAdminID($ID)){echo LOGIN_ERR;exit;}
    if(!Right_Check(1)){header('Location:'.ABSOLUTE_SERVER_DOCUMENT_ROOT.'error.php');exit;}
?>
<html>

<head>
	<?php echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET_.';">'; ?>
	<style  type="text/css"><!--
		table{
            border-bottom-color: black;
            border-top-color: black;
            border-left-color: black;
            border-right-color: black;
            border-collapse: collapse;
            font-size: 10px;
            font-family:  verdana;
        }
        form {margin-top:0pt; margin-bottom:0px;}
        img {margin-top:0pt; margin-bottom:0px;}
        body{
            margin-left:0pt;
            margin-right:0pt;
            margin-top:0pt;
            margin-bottom:0pt;
            font-family:  verdana;
            font-size: 10px;
        }
        input {
            border: 1px solid black;
            cursor: pointer;
            background-color: white;
            font-size: 10px;
            margin-left: 0px;
            padding-left: 0px;
            list-style-type: none;
            font-family:  Verdana;
        }
        a {
		  	text-decoration: none; 
		  	font-weight: normal; 
		  	color:black; 
		  	font-size:10px;
		}
		a:hover {
		  	text-decoration: underline; 
			font-weight: normal; 
			color:#808080; 
			font-size:10px;
		}
    --></style>

    <?php
        print "
            <script language=\"JavaScript\">
                <!--
                    function OpenPage(id, count){
                        var ComletPageName= \"".ABSOLUTE_SERVER_DOCUMENT_ROOT."show_product_detail.php\" + \"?ID=\" + id + \"&amp;Count=\" + count;
                        window.close(\"ShopBasketProductDetail\");
                        window.open(ComletPageName,\"ShopBasketProductDetail\",\"width=700px,height=300px,location=no,directories=no,menubar=no,resizeable=yes,status=no,toolbar=no,scrollbars=yes\");
                    }
                //-->
            </script>
        ";
    ?>
</head>

<?php
	print "<body bgcolor=\"".Background_Color."\">";
	
	$Category_ID 	= $_REQUEST['Category_ID'];
	$Insert_Product_ID 	= $_REQUEST['Insert_Product_ID'];	
	
do
{
    $_DB = new classDB();
    if ($_DB->open()){echo OPEN_DB_ERR; break;}
  	//***********************************************************************************************
	//PRACA S COOKIE PRI NOVOM PRODUKTE
	
	//-----------------------------------------------------------------------------------------------
	if ($_REQUEST['ProductID']==0){
		//COOKIE
		if (isset($_SESSION[SHARED_PRODUCTS_SESSION]))
	    	$CookieValue = $_SESSION[SHARED_PRODUCTS_SESSION];
	    else
	        $CookieValue="";
	}
    //-----------------------------------------------------------------------------------------------    
    
	//-----------------------------------------------------------------------------------------------
	//pridanie produktu
	if(($Insert_Product_ID!="") and ($_REQUEST['ProductID']==0))
		$CookieValue = Insert_Product_To_Cookie($CookieValue, $Insert_Product_ID);
	//-----------------------------------------------------------------------------------------------
	
	//-----------------------------------------------------------------------------------------------
	//odstranenie produktu z cookie
	if(($_REQUEST['Delete_Product_ID']!="") and ($_REQUEST['ProductID']==0))
		$CookieValue = Delete_Product_From_Cookie($CookieValue, $_REQUEST['Delete_Product_ID']);
	//-----------------------------------------------------------------------------------------------        
	
	//-----------------------------------------------------------------------------------------------
	//NADPIS
	if($_REQUEST['ProductID']=="0")
		print "<center><h4 style=\"margin-top:0pt; margin-bottom:0pt;\">".SP_VYBRANE_POLOZKY."</h4></center>";
	//-----------------------------------------------------------------------------------------------	
	
	//-----------------------------------------------------------------------------------------------
	//zoznam produktov z COOKIE
	if($_REQUEST['ProductID']=="0")
		Adm_Show_Products_From_Cookie($CookieValue, ABSOLUTE_SERVER_REMOTE_ADDR);
	//-----------------------------------------------------------------------------------------------
	
	//-----------------------------------------------------------------------------------------------
	//nastavenie COOKIE	
	if($_REQUEST['ProductID']=="0")
		$_SESSION[SHARED_PRODUCTS_SESSION] = $CookieValue;
	//-----------------------------------------------------------------------------------------------
	
    //***********************************************************************************************
   
   
   
   
	//***********************************************************************************************
	//UPARAVA DB PRI EDITE TOVARU
   
	//-----------------------------------------------------------------------------------------------
	//pridanie produktu
	if(($Insert_Product_ID!="") and ($_REQUEST['ProductID']!=0))
		Insert_Product($Insert_Product_ID,$_REQUEST['ProductID']);
	//-----------------------------------------------------------------------------------------------	
	
	//-----------------------------------------------------------------------------------------------
	//odstranenie produktu
	if(($_REQUEST['Delete_Product_ID']!="") and ($_REQUEST['ProductID']!=0))
		Delete_Product($_REQUEST['Delete_Product_ID']);
	//-----------------------------------------------------------------------------------------------
	
	//-----------------------------------------------------------------------------------------------
	//NADPIS
	if($_REQUEST['ProductID']!="0")
		print "<center><h4 style=\"margin-top:0pt; margin-bottom:0pt;\">".SP_VYBRANE_POLOZKY."</h4></center>";
	//-----------------------------------------------------------------------------------------------
	
	//-----------------------------------------------------------------------------------------------
	//zoznam produktov z DB
	if($_REQUEST['ProductID']!="0")
		Adm_Show_Products(ABSOLUTE_SERVER_REMOTE_ADDR, $_REQUEST['ProductID']);
	//-----------------------------------------------------------------------------------------------
	
	//***********************************************************************************************

	
	print "<br /><br />";
	//print "Vybran�ch produktov:".Selected_Products_Total_Count($_REQUEST['ProductID']);

    mysql_close();
}
while(false)
?>


</body>
</html>